#!/bin/bash
THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l)
yum install gcc gcc-c++ automake autoconf zlib zlib-devel openssl-devel pam-devel readline-devel gdbm-devel -y
#wget -c test.wgmf.com/mirrors/ruby/ruby-2.6.5.tar.bz2
# https://cache.ruby-china.com/pub/ruby/2.6/ruby-2.6.5.tar.bz2
tar xvf ruby-2.6.5.tar.bz2
cd ruby-2.6.5
./configure --prefix=/usr
make -j ${THREAD}
make install
cd ext/openssl
sed '1atop_srcdir = ../..' Makefile
ruby ./extconf.rb
make install
cd ../..
cd ..
ruby -v
tar xvf rubygems-3.2.4.tgz 
cd rubygems-3.2.4
ruby setup.rb --no-document
cd ..
gem -v
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
gem source -l
gem sources -c
gem sources -u

